package com.fastloan.utils;

import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

/**
 * 根据规则名称执行规则
 * @author chenkai
 *         createTime 2017-11-2017/11/9 16:58
 */
public class DroolsAcceptUtil implements AgendaFilter {
    private String ruleName;

    public DroolsAcceptUtil(String ruleName) {
        this.ruleName = ruleName;
    }

    @Override
    public boolean accept(Match match) {
        String name = match.getRule().getName();
        if (name.startsWith(ruleName)) {
            return true;
        }
        return false;
    }

}
